<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<title>权限设置 -- Powered by CentIMS {$core_version}</title>
		<link href="{'bootstrap/css/bootstrap.css'|shared}" rel="stylesheet"/>
		<link href="{'bootstrap/css/bootstrap-responsive.css'|shared}" rel="stylesheet"/>
		<link href="{'common.css'|shared}" rel="stylesheet"/>
		<style type="text/css">
			.opt {
				background-image:url('../images/icons/system.png');
			}
			.stuffbox{
				margin:5px;
				width: 170px;
			}	
			.res .btn-group{
				text-algin:center;
			}
		</style>
	</head>
	<body>
		<div class="workspace" style="margin-bottom:5px;">
			<input type="hidden" id="type" name="type" value="{$type}"/>
			<input type="hidden" id="uid" name="uid" value="{$uid}"/>
			<h1 class="title ico opt">权限设置</h1>
		    {if $page_tip_info}
		    <div class="alert alert-error">
		        <button class="close" data-dismiss="alert">×</button>
		        {$page_tip_info}
	      	</div>
	      	{/if}		
			<table id="grant-table" class="table">				
				<tbody id="resource">
					{foreach from=$items item=item}
					<tr>
						<td>
							<i class="handler icon-plus-sign" id="res_{$item.id}"></i>
							<strong>{$item.name}</strong>
						</td>
					</tr>
					<tr class="res res_{$item.id} hide" data-content="{$item.id}">
						<td>
							{foreach $item.operations as $res}
							{assign var=allow value=$grant->allow($item.id,$res.op)}
							<div class="stuffbox pull-left" data-content="{$res.op}">
								<h3 {icando res=$item.id op=$res.op uid=$uid type=$type} class="tgre" {icandoelse} class="tred" {/icando}>{$res.name}</h3>
								{if $res.extra}<a href="{$res.extra}" class="btn-extra tools {if $allow == -1}hide{/if}"><i class="icon-asterisk"></i></a>{/if}
								<div class="inside">
									<div class="input-prepend">
						            	<span class="add-on">优先级</span><input type="text" size="4" class="w80 ipt-priority" value="{$grant->priority($item.id,$res.op)}"/>
						            </div>
									<div class="btn-group" data-toggle="buttons-radio">
						                <button data-content="1" class="btn btn-op tgre {if $allow == 1}active{/if}">允许</button>
						                <button data-content="0" class="btn btn-op tred {if $allow == 0}active{/if}">禁止</button>
						            	<button data-content="-1" class="btn btn-op torg {if $allow == -1}active{/if}">继承</button>
						        	</div>
						        	<div class="overlay hide">
						        		<div class="loading"></div>
						        	</div>
					        	</div>
							</div>
							{/foreach}
							<br class="clear"/>
						</td>
					</tr>
					{/foreach}
				</tbody>
			</table>    
		</div>
		<script type="text/javascript" src="{'jquery-1.7.1.js'|jquery}"></script>
		<script type="text/javascript" src="{'bootstrap/bootstrap.js'|shared}"></script>
		<script type="text/javascript" src="{'common.js'|shared}"></script>
		<script type="text/javascript" src="grant.js"></script>		
	</body>
</html>
